UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lc1MiXKSXwy0uJZuh3XSTQwjbWej4m3sMlilh5M4unE='
WHERE
key_id = 'ecc2149e06fa5e21970f336e4e5e40a7f59cccd07f298f7ee8651c22a2bfe504'
AND (
token = 'lc1MiXKSXwy0uJZuh3XSTQwjbWej4m3sMlilh5M4unE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)