UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1co6aBUiWZXEWJyd0rNFCFBZtWm+gsdMPxyrwbHWP+o='
WHERE
key_id = 'e2491832daabe805620cddadaa297125cc0f45c08362dd67edcab48c8982081d'
AND (
token = '1co6aBUiWZXEWJyd0rNFCFBZtWm+gsdMPxyrwbHWP+o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)