UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l60Mf51z4OlgneRnczfbuwm3w6izdRGUahnquSkRsAw=' 
WHERE 
  key_id = '82868b1f14dbcf0355a18819317c817c1545d29ff78cb1309a3ddd935bd2a5db' 
  AND (
    token = 'l60Mf51z4OlgneRnczfbuwm3w6izdRGUahnquSkRsAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029