UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gA7RXKHiUKOzgqJX724Ek9+A5gKxNfktxgc430ZBqo4=' 
WHERE 
  key_id = 'aec244826708b53c20f7f1595743480e5a201e3d45948499f212785c86561537' 
  AND (
    token = 'gA7RXKHiUKOzgqJX724Ek9+A5gKxNfktxgc430ZBqo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027