UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KTnCs9QR92e3k5auBagPEzDlgTlWkdf3R/EjHGbknRE='
WHERE
key_id = '5cfba1b1622ebb728d7a9614d6dceb7654119aec4171a7b2925d07d70910d151'
AND (
token = 'KTnCs9QR92e3k5auBagPEzDlgTlWkdf3R/EjHGbknRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)