UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mx3bHq+cVht1T5AN3DqVskjXYfKx1xZLURhAXVlFPA0=' 
WHERE 
  key_id = '8d3989dab647f3406eeda9d3276b5372f6539d3ec7ff1d7778852d9ec9c2e516' 
  AND (
    token = 'Mx3bHq+cVht1T5AN3DqVskjXYfKx1xZLURhAXVlFPA0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022