UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3Hp3ZJ8+8Ux9QCPWZ0L0s5jkgSnfAlNxPfzuvM86wQ0=' 
WHERE 
  key_id = 'ad9ebe09704174da07980e6b78cea2220c214d7ec734f391c7092c07db47020a' 
  AND (
    token = '3Hp3ZJ8+8Ux9QCPWZ0L0s5jkgSnfAlNxPfzuvM86wQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018