UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WugXp1v4wHuj3n3HfJBe7Rlo1YqUcovv6T5Ngm726U0='
WHERE
key_id = 'd263066e362949b320c68f1de2d7c9c5c1a7bd84bcce5816d0e7a0a1f0a62b60'
AND (
token = 'WugXp1v4wHuj3n3HfJBe7Rlo1YqUcovv6T5Ngm726U0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)