UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+qYAB1TbWv8HgjrhMfo+vIhToSs34ypHSjZScRAhlDU='
WHERE
key_id = '471633f8697fac8488dcb35779d3724800650ca9f2a600b3e9516e75d86dabcc'
AND (
token = '+qYAB1TbWv8HgjrhMfo+vIhToSs34ypHSjZScRAhlDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)