UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P7yejhOJkY8MwGmivbvETt/6/aCHDpfphY+lWcL9i80=' 
WHERE 
  key_id = '6e80916a884760773650f9c586beb571e6fe39db2213c581da177ce33aba8c13' 
  AND (
    token = 'P7yejhOJkY8MwGmivbvETt/6/aCHDpfphY+lWcL9i80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027