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