UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Ae9VYdJ1Q3purOe9YSqo+ZvmQqUveKNH16hj2XKep0='
WHERE
key_id = '3ac85e0a897628957fccdbac0f63799345ee9a6bb476bab0093b12a67aebd37b'
AND (
token = '4Ae9VYdJ1Q3purOe9YSqo+ZvmQqUveKNH16hj2XKep0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)