UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G5Z40T6rFjBpBXLU566i1r43eikyUoPOqDC6KiqdoxQ='
WHERE
key_id = '9aa80cfbaf7dfa080e89a8424aaf73e71da3e2982e494ff3cf8542228c598703'
AND (
token = 'G5Z40T6rFjBpBXLU566i1r43eikyUoPOqDC6KiqdoxQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)