UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4wCTSXOsS3ZKR9M/HjWaBzHBZiWi5p7RRsNAY7ePgR8=' 
WHERE 
  key_id = '9edd6173cb875900f26964a5a2a4a1ea4febfa691c5f0c225efaec67518f1b31' 
  AND (
    token = '4wCTSXOsS3ZKR9M/HjWaBzHBZiWi5p7RRsNAY7ePgR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047