UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cck5FWx9z4bi5U2bNdKmcTQacd1/MgdxWQXkYVUEHvc=' 
WHERE 
  key_id = '2f4cac5d844c5eca69c2a86c27439c6a8bdb263bafc66ac5aed83363b15613c3' 
  AND (
    token = 'Cck5FWx9z4bi5U2bNdKmcTQacd1/MgdxWQXkYVUEHvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047