UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0Z9am7JEy0tKJ33G0Y2h4c6SZzppf+/FyLKWC2vsB4=' 
WHERE 
  key_id = '96132e1de67c8c3faab7b00f0ef3cdbaaf1402c7f1b93fb5608e70f8852571d7' 
  AND (
    token = 'O0Z9am7JEy0tKJ33G0Y2h4c6SZzppf+/FyLKWC2vsB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022