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