UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7Q27JX9ZjZizbPhYYx0TRicu7inmX0xQtbaYOm0BFM='
WHERE
key_id = '428e77dc9c6f85c3a4a3d1b1dcfd2d47b3d4f635313efe9d4c3084966cdcf77c'
AND (
token = 'r7Q27JX9ZjZizbPhYYx0TRicu7inmX0xQtbaYOm0BFM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)