UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bu6xU9jouIEuFA6W+LcQYKmr8HTt+/1PfyrEqDWObV4='
WHERE
key_id = '1ce436cb57e54a3d136724e8c0c6af2aa3f9c9852fb10af12f54d0f0e388b1d4'
AND (
token = 'Bu6xU9jouIEuFA6W+LcQYKmr8HTt+/1PfyrEqDWObV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)