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