UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E66XuQrSoMOT+o3Re9BkcaDvMZZRowuExxSOGICRciM='
WHERE
key_id = '065f6f94b663e89ca73913d95378f8be4eb9199ce056334e69f6a78671fedc27'
AND (
token = 'E66XuQrSoMOT+o3Re9BkcaDvMZZRowuExxSOGICRciM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)