UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gmat70+poufpZRiWM+Iw6p34QFkrSepkIwF9y2wdTg8='
WHERE
key_id = 'cd5ab30e36b200fad96c80a9aed4bd7ffe48c4aca1e3540db253b0e91b115675'
AND (
token = 'gmat70+poufpZRiWM+Iw6p34QFkrSepkIwF9y2wdTg8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)