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