UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tCLeIal6wfKJC+2Q8vNaBsEm3UMq8A3f30uV+2WkBdw='
WHERE
key_id = 'ee678cb4eefc47ee3988c57a8642d5ed89437684d6c5f0a67801eda14b28dd0b'
AND (
token = 'tCLeIal6wfKJC+2Q8vNaBsEm3UMq8A3f30uV+2WkBdw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)