UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '58TM1FnNYVLVNBooRFKblPyZhru0liAky17zpl69OVY=' 
WHERE 
  key_id = '1d32858625326f35d6d3e14dcbf9f4853bce528548f90fa2926dc584802f846d' 
  AND (
    token = '58TM1FnNYVLVNBooRFKblPyZhru0liAky17zpl69OVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037