UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cBX4ouci71JvKsUbAyDJjEjG8mtttOVkIH7H1ZKFVp8='
WHERE
key_id = '778577a2614b7d0720ef34cb307c28726dbbf1bf0b6e35e5d16c9173976beb3f'
AND (
token = 'cBX4ouci71JvKsUbAyDJjEjG8mtttOVkIH7H1ZKFVp8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)