UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+rEsyZRfktk2mSWYzxI5w0vtDe0h58rFIQRViGkdKMU='
WHERE
key_id = '22b13ee8d931484528ab69804a2e1dbecc7f4d993710601adf735db2252639b3'
AND (
token = '+rEsyZRfktk2mSWYzxI5w0vtDe0h58rFIQRViGkdKMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)