UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'focGg3r3fbrjTn8nj0a45V/1hETG1RQHCA2II0YMUbU=' 
WHERE 
  key_id = '6dffaab779214cad65508e4866c56acc6b49978d9127bfd049d8eb5c165ce549' 
  AND (
    token = 'focGg3r3fbrjTn8nj0a45V/1hETG1RQHCA2II0YMUbU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049