UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'COeOs2uyeukSmr6HxlmVTIr/GtFS8VriOCodOnHXCfc=' 
WHERE 
  key_id = '4f77460a87c11a0ed8e8708c1a0a7326a617e70b3a8c570eb4df380b013ad2d8' 
  AND (
    token = 'COeOs2uyeukSmr6HxlmVTIr/GtFS8VriOCodOnHXCfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064