UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PmWGJpjIg254u90WG0mX99TVnf4EBy1IuMUefxgFuHU=' 
WHERE 
  key_id = 'ad0bd211cf51b026bfd19035d8e8c33367b59c532083a0133259dd59304b22ee' 
  AND (
    token = 'PmWGJpjIg254u90WG0mX99TVnf4EBy1IuMUefxgFuHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032