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