UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6S7E1DUI9CZBInmn+FFA2Cr+W9sn/XEvtyQRVrklG48=' 
WHERE 
  key_id = 'fe0fb778bcb8931c7a612e2729be221cd065394437ebadb06c74249e28ec635c' 
  AND (
    token = '6S7E1DUI9CZBInmn+FFA2Cr+W9sn/XEvtyQRVrklG48=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037