UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TtzAPCv2766BN9AowLuZB5eIocPO7QUj0cj2sBEHdLc='
WHERE
key_id = '58e9865e7bd7e6dbe1540f2c567233ce22929d14da06abd7ca9001b808ec0925'
AND (
token = 'TtzAPCv2766BN9AowLuZB5eIocPO7QUj0cj2sBEHdLc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)