UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pBWcNbDKlU47cMVT6Wmnp/ynms9GhF8VvWr9xBu95ms=' 
WHERE 
  key_id = '14f71589780e41c088ff8f85c474ec80cafc34142379a937684f71208cf67672' 
  AND (
    token = 'pBWcNbDKlU47cMVT6Wmnp/ynms9GhF8VvWr9xBu95ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029