UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hMnz41otCSN4xxjiJ2Wsb6o9TxHpvudkElstfQAT29I=' 
WHERE 
  key_id = '361881365986ecd129267fbe1cba504c8fd2825af18276b5aa539109771d0b69' 
  AND (
    token = 'hMnz41otCSN4xxjiJ2Wsb6o9TxHpvudkElstfQAT29I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047