UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v8CHULYzfXHSte3leDDfLZrH6jmv/0ZK2enQx0l2NYA=' 
WHERE 
  key_id = '89c7ed334c8f8ea65ddc980c11bb93601fbb4dd48c9d752e37cfd8b9c0803b1c' 
  AND (
    token = 'v8CHULYzfXHSte3leDDfLZrH6jmv/0ZK2enQx0l2NYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023