UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i99LcE/JsztQs5eMqAwSEtU7WU3HtSAmJll3nFhP5QE='
WHERE
key_id = 'd7d27a4819431b632652405224504d3dfcf2c23c2dbb54aeb915ad1e04ca9096'
AND (
token = 'i99LcE/JsztQs5eMqAwSEtU7WU3HtSAmJll3nFhP5QE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)