UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'el4BWWGkUXCR7BUlkpNyAXhHpD2KxV4bGaSgGVmopJw=' 
WHERE 
  key_id = '4a09f196d1f6e61ab89b09a99c173e6cf264e22c896b2f92bb770f45f990987d' 
  AND (
    token = 'el4BWWGkUXCR7BUlkpNyAXhHpD2KxV4bGaSgGVmopJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029