UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TBEFcEevi5SrF8WPawsA6eRD7P4MME4av4rlpo36o+0='
WHERE
key_id = 'a507a1df43cfd3cd078d605fb51e00a2c90f188cc5187677c6095474b6b529ee'
AND (
token = 'TBEFcEevi5SrF8WPawsA6eRD7P4MME4av4rlpo36o+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)