UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'F8SGZX4KshNOwLUcr1tOTRaQ5egsyronV0+MpNp1G1Q='
WHERE
key_id = '57123ffc9f05fa355c6e05396790f364c02778f818f7c3f43e483dda22ec6271'
AND (
token = 'F8SGZX4KshNOwLUcr1tOTRaQ5egsyronV0+MpNp1G1Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)