UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yq6QzD5BrkcSdGC1WFxDDzibzWw4yeHk8F8wLHaWPLU='
WHERE
key_id = '475b84a8216c52f0114debc1a2d239967d8ebac43a7825c395af2a5255e3fbef'
AND (
token = 'Yq6QzD5BrkcSdGC1WFxDDzibzWw4yeHk8F8wLHaWPLU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)