UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KvQ5QiJ3FGlFvKgutaTLASgwZWPUs6iIvW42FHjk1gI='
WHERE
key_id = '4b1f20e11ea0e01ae2a1896375349bf0cd2546b32fd385f8a6fd1ed748d2cec7'
AND (
token = 'KvQ5QiJ3FGlFvKgutaTLASgwZWPUs6iIvW42FHjk1gI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)