UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'res+E/Ura/6fivnHXaqq3Eda9k3xErD8c/G0baZ+R5o='
WHERE
key_id = 'b8e719d99599ccda19497bbc01e82957487900606ce0c11fac42687fb753dde3'
AND (
token = 'res+E/Ura/6fivnHXaqq3Eda9k3xErD8c/G0baZ+R5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)