UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I2FoFjiyOYdwhHYgXavG4klNlz8fkS59uHUft8RKaTk=' 
WHERE 
  key_id = '3c2a95cc6219e01bc8f1af2b7249b87bf0c9a02c215a36dfa0844eb431e3e949' 
  AND (
    token = 'I2FoFjiyOYdwhHYgXavG4klNlz8fkS59uHUft8RKaTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028